package com.asset.dispoal.evidenceType;

import com.asset.dispoal.evidenceType.api.BsEvidenceTypeService;
import com.asset.dispoal.evidenceType.dto.BsEvidenceTypeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.controller.BaseController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * 证据种类表控制层
 *
 * @author: mhuang
 * @date: 2022-03-24 09:42:45
 */
@RestController
@RequestMapping("sys/bsEvidenceType")
@Api(value = "证据种类管理", tags = "证据种类管理")
public class BsEvidenceTypeController extends BaseController {

    @Autowired
    private BsEvidenceTypeService bsEvidenceTypeService;

    @Permission(code = "generalEvidenceClass", param = "create_user")
    @GetMapping(value = "/page")
    @ApiOperation(value = "查询", notes = "查询")
    public Result page(BsEvidenceTypeRequest request) {
        return bsEvidenceTypeService.queryPage(request);
    }

    @Permission(code = "generalEvidenceClass:add")
    @PostMapping(value = "/insert")
    @ApiOperation(value = "添加", notes = "添加")
    public Result insert(@RequestBody BsEvidenceTypeRequest request) {
        return bsEvidenceTypeService.insert(request);
    }

    @Permission(code = "generalEvidenceClass:update")
    @PutMapping(value = "/update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody BsEvidenceTypeRequest request) {
        return bsEvidenceTypeService.update(request);
    }

    @Permission(code = "generalEvidenceClass:del")
    @PostMapping(value = "/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(@RequestBody String id) {
        return bsEvidenceTypeService.delete(id);
    }
}